using System;
using System.Collections.Generic;
using System.Text;

namespace PlanningPoker.Controllers
{
    public class LoginController : Castle.MonoRail.Framework.SmartDispatcherController
    {
        public void index()
        {


        }

        public void Login(string username, string password)
        {
            Model.CardPlayer user = Model.CardPlayer.FindCardPlayer(username, password);


            if (user == null)
            {
                //Failure message for the login page
                Flash["failmessage"] = "user does not exist or incorrect password.";
                return;
            }

            Context.CurrentUser = user;

            Redirect("home", "index");
            

        }
    }
}
